home *** CD-ROM | disk | FTP | other *** search
- Path: cnn.Princeton.EDU!franck!tim
- From: tim@franck (Tim Hollebeek)
- Newsgroups: comp.lang.c++
- Subject: Re: cin.get() function challenge
- Date: 27 Jan 1996 02:39:35 GMT
- Organization: Princeton University
- Message-ID: <4ec397$nra@cnn.Princeton.EDU>
- References: <4eavds$d0u@news.cencom.net>
- NNTP-Posting-Host: franck.princeton.edu
- X-Newsreader: TIN [version 1.2 PL2]
-
- Will Senn (wsenn@cencom.net) wrote:
- : Alrighty then!
-
- : Some of you may recall my post of a week ago asking for help on getch() and
- : cin. The responses I received were not encouraging.
-
- : The problem:
- : Write a function in C++ not using getch() that will read in ONE
- : character at a time, without line buffering. In other words when the user
- : presses ONE key, take and process that keypress. I had originally asked if
- : it was possible to use cin or another iostream for this purpose. It would be
- : nice if someone could definitively address this question.
-
- The answer is no. It isn't possible. It isn't possible in ANSI C either;
- getch() isn't a standard function, though it is widely available.
- Unfortunately, I don't know of any stream-friendly, widely available
- equivalent for C++. Check your compiler documentation, it should
- document the library functions available. (Although C++ libraries are
- pretty sparse; compiler writers are still struggling to get the
- language/new standard library right)
-
- : If someone out there has a grip on this rather complex issue, I would very
- : much appreciate a reply, by mail or post.
-
- It isn't really complex; it just isn't a language issue.
-
- --
- Tim Hollebeek | Everything above is a true statement, for sufficiently
- PChem Grad Student | false values of true.
- Princeton Univ. | tim@wfn-shop.princeton.edu
- -------------------| http://wfn-shop.princeton.edu/~tim
-